package com.wuyu.easyid.server.service.id;

import com.wuyu.easyid.base.factory.AbstractIdGeneratorFactory;
import com.wuyu.easyid.base.generator.IdGenerator;
import com.wuyu.easyid.base.generator.SegmentIdCache;
import com.wuyu.easyid.base.service.SegmentIdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


/**
 * ID生成服务.
 */
@Component
public class IdGeneratorServer extends AbstractIdGeneratorFactory {

    /**
     * ID块服务.
     */
    @Autowired
    private SegmentIdService segmentIdService;

    @Override
    public IdGenerator createIdGenerator(Integer bizType) {
        return new SegmentIdCache(bizType, segmentIdService);
    }

}
